function Food(el)
{
    this.el=el
    this.len=20
    this.foodObj=null
    this.foodX=0
    this.foodY=0
    this.init()

}
Food.prototype.init=function(){
    let foodObj=document.createElement('div')
    foodObj.style.width=this.len+'px'
    foodObj.style.height=this.len+'px'
    foodObj.style.background='yellow'
    foodObj.style.borderRadius='50%'
    foodObj.style.position='absolute'
    
    this.foodObj=foodObj
    this.el.appendChild(foodObj)
    this.move()
}
Food.prototype.move=function(){
    let maxl=parseInt(this.el.style.width)/this.len-1
    let maxt=parseInt(this.el.style.height)/this.len-1
    let min=0
    this.foodX=Math.floor(Math.random()*(maxl-min+1)+min)*this.len
    this.foodY=Math.floor(Math.random()*(maxt-min+1)+min)*this.len
    this.foodObj.style.left=this.foodX+'px'
    this.foodObj.style.top=this.foodY+'px'
}
